/**
 * 
 */
package com.wjk.connectdb.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.wjk.connectdb.bean.User;
import com.wjk.connectdb.dao.UserRepository;

/**
 *
 * <br>
 *
 * @author wanjk@c-platform.com
 *
 *         <p>
 * @date 创建时间：2018年4月9日:上午12:16:22
 *       </p>
 *
 * 
 */

@RestController
@RequestMapping(path = "/demo")
public class UserController {

	@Autowired
	private UserRepository userResposRepository;

	@GetMapping(path = "/add")
	public @ResponseBody String addNewUser(@RequestParam String name,
			@RequestParam String email,HttpServletResponse res) {

		User user = new User();
		user.setName(name);
		user.setEmail(email);
		userResposRepository.save(user);
		return "save" ;
	}

}
